﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<ali:Get ID="Template" Object="Template" Operation="Get(Request.QueryString['TemplatePath'])" Validate="True" />
<ali:Get ID="Candidate" Object="InstanceConfig" Operation="GetLanguageSettings()" Lang="PageLang" />
<script language="c#" runat="server">
protected string _sourceLanguageAb;
protected string SourceLanguageAb
{
	get
	{
		if (!String.IsNullOrEmpty(_sourceLanguageAb))
			return _sourceLanguageAb;
		
		_sourceLanguageAb = Template[Alias.Template.Language].ToString();
		if (String.IsNullOrEmpty(_sourceLanguageAb))
			_sourceLanguageAb = PageLang;
			
		return _sourceLanguageAb;
	}
}

protected string _sourceLanguage = null;
protected string SourceLanguage
{
	get
	{
		if (_sourceLanguage != null)
			return _sourceLanguage;
			
		_sourceLanguage = Candidate.Select(Alias.Language.Ab + "='" + SourceLanguageAb + "'")[0][Alias.Language.Name].ToString();

		return _sourceLanguage;
	}
}

protected string _targetLanguageAb;
protected string TargetLanguageAb
{
	get
	{
		if (!String.IsNullOrEmpty(_targetLanguageAb))
			return _targetLanguageAb;
		
		if (!String.IsNullOrEmpty(Request.QueryString["Language"]))
		{
			_targetLanguageAb = Request.QueryString["Language"];
		}
		else if (Request.Cookies["TargetLanguageAb"] != null)
		{
			_targetLanguageAb = Request.Cookies["TargetLanguageAb"].Value;
		}
		else
		{
			foreach (DataRow row in Manager.Languages.Rows)
			{
				if (row[Alias.Language.Ab].ToString() != SourceLanguageAb)
				{
					_targetLanguageAb = row[Alias.Language.Ab].ToString();
					break;
				}
			}
		}
			
		return _targetLanguageAb;
	}
}

protected string _targetLanguage = null;
protected string TargetLanguage
{
	get
	{
		if (_targetLanguage != null)
			return _targetLanguage;
			
		if (String.IsNullOrEmpty(TargetLanguageAb))
			_targetLanguage = String.Empty;
		else
			_targetLanguage = Candidate.Select(Alias.Language.Ab + "='" + TargetLanguageAb + "'")[0][Alias.Language.Name].ToString();

		return _targetLanguage;
	}
}
</script>
<section data-page="template_dictionary_list" data-title="词典" data-lang="<%=ContentLang%>" data-template-path="<%=Request.QueryString["TemplatePath"]%>">
	<dl class="path1">
		<dt><span>您的位置：</span><a href="list.aspx" target="ali-navtab">模板列表</a> → <%=Request.QueryString["TemplatePath"]%></dt>
	</dl>
	<div class="ali-tabs sub-nav" data-height-style="fill" data-event="click">
		<div class="ali-tabs-header">
			<div class="ali-tabs-nav-container">
				<ul>
					<li><a href="edit.aspx?Path=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">编辑</a></li>
					<li class="ali-active"><a>词典</a></li>
					<li><a href="module.aspx?TemplatePath=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">模块邦定</a></li>
					<li><a href="pages/list.aspx?TemplatePath=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">页面列表</a></li>
					<li><a href="pages/add.aspx?TemplatePath=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">添加页面</a></li>
					<li><a href="script/list.aspx?TemplatePath=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">脚本列表</a></li>
					<li><a href="script/add.aspx?TemplatePath=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">添加脚本</a></li>
					<li><a href="menu/list.aspx?TemplatePath=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">模块菜单</a></li>
					<li><a href="menu/add.aspx?TemplatePath=<%=Request.QueryString["TemplatePath"]%>" target="ali-navtab">添加菜单</a></li>
				</ul>				
			</div>
		</div>
		<div class="ali-tabs-body">
			<div class="ali-tabs-panel"></div>
			<div class="ali-tabs-panel">
				<form action="?TemplatePath=<%=Request.QueryString["TemplatePath"]%>&Language=<%=TargetLanguageAb%>" class="search1" style="display:none"><button type="submit" class="ali-button">搜索</button></form>
				<form action="" class="add1">
					标识：<input type="text" name="Name" size="20" class="ali-input">
					源语言（<%=SourceLanguage%>）：
						<textarea name="From" cols="20" rows="2" class="ali-input <%=SourceLanguageAb%>Font"></textarea>
					目标语言（<select name="TargetLanguageAb" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
								<ali:List Object="Language" Source="Candidate">
									<ali:Record>
										<%If !String.Equals(Ab, SourceLanguageAb)%>
											<%If String.Equals(Ab, TargetLanguageAb)%>
												<option value="<%=Ab%>" selected="selected"><%=Name%></option>
											<%Else%>
												<option value="<%=Ab%>"><%=Name%></option>
											<%EndIf%>
										<%EndIf%>
									</ali:Record>
								</ali:List>
							</select>）：
						<textarea name="To" cols="20" rows="2" class="ali-input <%=TargetLanguageAb%>Font"></textarea>
					<button type="submit" class="ali-button">添加</button>
					<button type="button" class="ali-button" data-operation="GetChineseString">抽取中文</button>
				</form>
				<div class="content">
					<table data-ali-widget="grid" class="grid1">
						<thead>
							<tr>
								<th>标识</th>
								<th>源语言（<%=SourceLanguage%>）</th>
								<th>目标语言（<%=TargetLanguage%>）</th>
								<th width="80">修改</th>
								<th width="80">删除</th>
							</tr>
						</thead>
						<tbody>
							<ali:List ID="List" Object="Template.Dictionary" Page="PageNumber" PageSize="PageSizeValue" Condition="TemplatePath=Request.QueryString['TemplatePath'] and Language=TargetLanguageAb" Validate="True">
								<ali:Record>
									<tr data-id="<%=ID%>">
										<td><input type="text" name="Name" value="<%=Name%>" size="10" class="Text" ></td>
										<td><textarea name="From" cols="30" rows="2" class="ali-input <%=SourceLanguageAb%>Font"><%=From%></textarea></td>
										<td><textarea name="To" cols="30" rows="2" class="ali-input <%=TargetLanguageAb%>Font"><%=To%></textarea></td>
										<td><a href="" class="ali-button" data-operation="Modify">修改</a></td>
										<td><a href="" class="ali-button" data-operation="Delete">删除</a></td>
									</tr>
								</ali:Record>
							</ali:List>
						</tbody>
					</table>
					<ali:Pagination Page="PageNumber" PageSize="PageSizeValue" RecordCount="List[RecordCount]">
						<div class="pagination1" data-page-number="<%=PageNumber%>" data-page-count="<%=PageCount%>" data-page-size="<%=PageSize%>">
							<div class="pagination1-left">
								共<b><%=PageCount%></b>页，每页显示
									<select name="PageSize" data-ali-widget="combo">
										<option value="20">20</option>
										<option value="50">50</option>
										<option value="100">100</option>
										<option value="200">200</option>
									</select>条，共<b><%=RecordCount%></b>条记录
							</div>
							<ul class="pagination1-right">
								<ali:FirstPage>
									<ali:Yes>
										<li><span><span class="first disabled">首页</span></span></li>
										<li><span><span class="prev disabled">上一页</span></span></li>
									</ali:Yes>
									<ali:No>
										<li><a href="1"><span class="first">首页</span></a></li>
										<li><a href="<%=PageNumber - 1%>"><span class="prev">上一页</span></a></li>
									</ali:No>
								</ali:FirstPage>
								<ali:CurrentPage Range="5">
									<ali:Yes>
										<li class="active"><span><%=Index%></span></li>
									</ali:Yes>
									<ali:No>
										<li><a href="<%=Index%>"><%=Index%></a></li>
									</ali:No>
								</ali:CurrentPage>
								<ali:LastPage>
									<ali:Yes>
										<li><span><span class="next disabled">下一页</span></span></li>
										<li><span><span class="last disabled">末页</span></span></li>
									</ali:Yes>
									<ali:No>
										<li><a href="<%=PageNumber + 1%>"><span class="next">下一页</span></a></li>
										<li><a href="<%=PageCount%>"><span class="last">末页</span></a></li>
									</ali:No>
								</ali:LastPage>
			
								<li class="go">
									<input type="text" name="PageNumber" value="1" size="4"><button></button>
								</li>
							</ul>
						</div>
					</ali:Pagination>
				</div>
			</div>
		</div>
		<div class="ali-tabs-bottom"><b></b></div>
	</div>
</section>